<h1>Finanse </h1>
<% form_for :payment, :url => { :controller => 'payments', :action => 'create'},
	:html => { :id => 'payment_form', :style => 'overflow: auto;' } do |f| %>
	<label for="text_field_with_auto_complete">Użytkownik</label>
	<%= text_field_with_auto_complete :user, :email,
		{ :url => {:action => 'list'}, :method => :get,
		:param_name => 'search' } %>
	<%= f.text_field :amount, :label => 'Kwota wpłaty', :value => '0' %>
	<%= f.text_field :comment, :label => 'Komentarz',
		:help => 'Domyślnie wpłata (możliwa wypłata z konta pre-paid)', :value => 'Wpłata na konto'%>
	<%= submit_tag 'Dodaj transakcję' %>
	<br></br>
	<br></br>
<% end %>
<% if !@debtors.blank? %>
	<h2>Z opłatami zalegają:</h2>
	<ul>
		<% for d in @debtors %>
			<li>
				<%= link_to d.name, :action => "show_user", :id => d.id %> (<%= number_to_currency(d.saldo) %>)
				[ <%= link_to "wyślij przypomnienie", :controller => 'users', :action => "send_reminder", :id => d.id%> ]
			</li>
		<% end %>
	</ul>
<% end %>
<div id="payments" style="margin-top: 10px">
	<h2>Lista transakcji</h2>
	<%= twill_paginate @payments, :style => 'font-size: small' %>
	<%= render :partial => 'payments/payment', :collection => @payments %>
</div>

